package org.example.factoryBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Client {

    //方式一：直接注入Service，service默认会使用ServiceFactoryBean创建
    @Autowired
    private Service service;

    /* 方式二：注入FactoryBean，并使用FactoryBean获取
    @Autowired
    private ServiceFactoryBean serviceFactoryBean;*/

    public void doSomething() throws Exception {
        //Service service = serviceFactoryBean.getObject();
        service.perform();
    }
}
